﻿<%@ Page Title="Strategic Asset Management Las Vegas: Master Report" Language="C#" MasterPageFile="~/Site2.Master" AutoEventWireup="true" CodeBehind="LvreoMasterListEx.aspx.cs" Inherits="LenderClearingHouse.LvreoMasterListEx" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="ListFilterControl.ascx" TagName="ListFilterControl" TagPrefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphPageHeader" runat="server">
    Master Report
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphMain" runat="server">
  <telerik:RadWindowManager runat="server" Behavior="Default" InitialBehavior="None"
        ID="RadWindowManager1" Modal="True" Behaviors="Resize, Close, Move" ReloadOnShow="True"
        ShowContentDuringLoad="False" VisibleStatusbar="False" VisibleTitlebar="True"
        Width="500px" Title="NET SHEET">
  </telerik:RadWindowManager>

    <script type="text/javascript">
      function OpenNetSheetDialog() {
        //var pprice = $('#ctl00_cphMain_grid_ctl00_ctl05_tbPurchasePrice').val();
        //if (!pprice) pprice = 0;
        //else pprice = pprice.split('&nbsp;').join('').replace('.00', '').split(',').join('');
        //ppprice = pricePurchase;

        var pprice = $('#div-buyer-purchase-price-value').html();
        if (!pprice)
          pprice = 0;

        var propertyid = $('#div-propertyid').html();
        if (!propertyid) {
          alert('Unknown property id!')
          return;
        }

        var costs = $('#div-rehab-costs-value').html();
        if (!costs)
          costs = 0;
                  
        /*var pprice = $("[id*='tbPurchasePrice']");
        if (!pprice)
          pprice = 0;
        else {
          pprice = pprice[0].value;
          pprice = pprice.split('&nbsp;').join('').replace('.00', '').split(',').join('');
        }*/

        var oWnd = radopen("NetSheetDialog.aspx?PurchasePrice=" + encodeURIComponent(pprice) + "&RehabCosts=" + encodeURIComponent(costs) + "&PropertyId=" + encodeURIComponent(propertyid), "RadWindow1");
        oWnd.setSize(800, 700);
        oWnd.Center();
        return false;
      }

      function SetNetProfit(netProfit, buyerPurchasePrice, buyerPurchasePriceValue, rehabCosts, rehabCostsValue, purchasePrice, purchasePriceValue) {
        $('#div-net-profit').html(netProfit);
        $('#div-buyer-purchase-price').html(buyerPurchasePrice);
        $('#div-buyer-purchase-price-value').html(buyerPurchasePriceValue);

        /*var costs = $("[id*='tbRehabCosts']");
        if (costs)
          costs[0].value = rehabCosts;*/

        $('#div-rehab-costs').html(rehabCosts);
        $('#div-rehab-costs-value').html(rehabCostsValue);

      }
      </script>

    <fieldset>
    <legend>Parameters</legend>
        &nbsp;&nbsp;T1,&nbsp;%:&nbsp;<asp:TextBox ID="tbT1" runat="server" ValidationGroup="percents"></asp:TextBox>&nbsp;&nbsp;
        AA1,&nbsp;%:&nbsp;<asp:TextBox ID="tbAA1" runat="server" ValidationGroup="percents"></asp:TextBox>&nbsp;&nbsp;
        <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" ValidationGroup="percents" />
        <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="Invalid values" ControlToValidate="tbT1" MinimumValue="0" MaximumValue="100" ValidationGroup="percents" SetFocusOnError="True" Type="Currency" Display="Dynamic"></asp:RangeValidator>
        <asp:RangeValidator ID="RangeValidator2" runat="server" ErrorMessage="Invalid values" ControlToValidate="tbAA1" MinimumValue="0" MaximumValue="100" ValidationGroup="percents" SetFocusOnError="True" Type="Currency" Display="Dynamic"></asp:RangeValidator>
        <br /><br />
    </fieldset>
    <br />
    <uc1:ListFilterControl ID="listFilter" runat="server" />
    <!--Panel Five: "Export & etc..."-->
    <div class="panel5">
        <table width="940" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="122" height="32" valign="middle">
                    &nbsp;
                </td>
                <td width="40" valign="middle">
                    <img src="images/excel_icon.png" width="30" height="30" />
                </td>
                <td width="137" valign="middle">
                    <asp:LinkButton ID="lnkExportToExcel" CssClass="link1" runat="server" OnClick="lnkExportToExcel_Click" Text="Export To Excel"></asp:LinkButton>
                </td>
                <td width="40" valign="middle">
                    <img src="images/refresh_icon.png" width="30" height="30" />
                </td>
                <td width="118" valign="middle">
                    <asp:LinkButton ID="lnkRefreshGrid" CssClass="link1" runat="server" OnClick="lnkRefreshGrid_Click" Text="Refresh Grid"></asp:LinkButton>&nbsp;
                </td>
                <td width="40" valign="middle">
                    <img src="images/refresh_icon.png" width="30" height="30" />
                </td>
                <td width="150" valign="middle" id="td1" runat="server">
                    <asp:LinkButton ID="lnkShowUnassigned" CssClass="link1" runat="server" Text="Show All Unassigned"
                        OnClick="lnkShowUnassigned_Click"></asp:LinkButton>
                </td>
                <td width="*">
                    &nbsp;
                </td>
            </tr>
        </table>
    </div>
    <!--Panel Five: "Export & etc..." Ends-->
    <!--Panel Six: "Postponed & etc..."-->
    <!--Panel Six: "Postponed & etc..." Ends-->
    <!--Blank List-->
    <div class="blank_list1">
    </div>
    <!--Blank List Ends-->
    <!--Panel Seven: "Grid Area"-->
    <div class="panel7">
        <asp:PlaceHolder ID="phGrid" runat="server"></asp:PlaceHolder>
    </div>
    <!--Panel Seven: "Grid Area" Ends-->
    <!--Blank List-->
    <div class="blank_list1">        
    </div>
    <!--Blank List Ends-->
    <telerik:GridTextBoxColumnEditor ID="edTextBox" runat="server" 
        TextBoxMode="MultiLine">
    </telerik:GridTextBoxColumnEditor>
    <asp:SqlDataSource ID="sqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:SQLConnection %>"        
        OnSelecting="sqlDataSource_Selecting" SelectCommand="getLvreo_MasterListEx"
        SelectCommandType="StoredProcedure" UpdateCommand="updateLvreo_MasterListEx" UpdateCommandType="StoredProcedure" CancelSelectOnNullParameter="False">
    </asp:SqlDataSource>
    <telerik:RadAjaxManager ID="RadAjaxManager" runat="server">
    </telerik:RadAjaxManager>
</asp:Content>
